package com.rinlink.gateway.jt808.jt808.webhook;

import com.rinlink.gateway.jt808.service.Jt808GatewayWebHookService;
import io.github.hylexus.jt808.session.ISessionCloseReason;
import io.github.hylexus.jt808.session.Jt808Session;
import io.github.hylexus.jt808.session.Jt808SessionManagerEventListener;

import javax.annotation.Nullable;


public class Jt808WebHookSessionListener implements Jt808SessionManagerEventListener {

    Jt808GatewayWebHookService jt808GatewayWebHookService;

    public Jt808WebHookSessionListener(Jt808GatewayWebHookService jt808GatewayWebHookService) {
        this.jt808GatewayWebHookService = jt808GatewayWebHookService;
    }

    @Override
    public void onSessionAdd(@Nullable Jt808Session session) {
    }

    @Override
    public void onSessionClose(@Nullable Jt808Session session, ISessionCloseReason closeReason) {
        jt808GatewayWebHookService.terminalDisconnect(session.getTerminalId());
    }


    @Override
    public void onSessionRemove(@Nullable Jt808Session session) {
   //     jt808GatewayWebHookService.terminalDisconnect(session.getTerminalId());
    }
}
